package kii.utils
{
	public class TimeUtil
	{
		static private const SECONDS_IN_HOUR:int = 3600;
		static private const SECONDS_IN_MINUTE:int = 60;

		static public function secondsToString(totalSeconds:uint):String
		{
			var h:int = Math.floor(totalSeconds / SECONDS_IN_HOUR);
			totalSeconds = totalSeconds % SECONDS_IN_HOUR;
			var m:int = totalSeconds / 60;
			var s:int = totalSeconds % 60;
			
			var hs:String = addTralingZero(h.toString());
			var ms:String = addTralingZero(m.toString());
			var ss:String = addTralingZero(s.toString());
			
			return hs + ':' + ms + ':' + ss;
		}
		
		static private function addTralingZero(numberString:String, desiredLength:int = 2):String
		{
			while(numberString.length < desiredLength)
				numberString = '0' + numberString;
			return numberString;
		}
	}
}